angular.module('app').controller('positionCtrl',['$q','$http','$state','$scope','cache',function($q,$http,$state,$scope,cache){
	cache.put('is','ok');
	cache.remove('is');
	$scope.isLogin = false;
	function getPosition(){
		var def = $q.defer();
	$http.get('/data/position.json?id='+$state.params.id).success(function(data){
		$scope.position=data;
		def.resolve(data)

	}).error(function(err){ def.reject(err) })
	return def.promise;
	}
	function getCompany(id){
		$http.get('data/company.json?id='+id).success(function(res){
			$scope.company = res;
		})
	}
	getPosition().then(function(obj){
		getCompany(obj.companyId)

	})
}])